package org.hpin.asset.dao;

import java.util.List;

import org.hpin.asset.entity.AssetDamageInfo;
import org.hpin.common.core.orm.BaseDao;
import org.springframework.stereotype.Repository;

@Repository()
public class AssetDamageInfoDao extends BaseDao {
	
	/**
	 * 查询最大的单号
	 * @return
	 */
	public AssetDamageInfo findMax(){
		String hql="from AssetDamageInfo a where a.damageNo=(select max(b.damageNo) from AssetDamageInfo b" +
				" where trunc(b.time) = trunc(sysdate))";
		List<AssetDamageInfo> list=this.getHibernateTemplate().find(hql);
		if(list.size()==0){
			return null;
		}else{
			return list.get(0);
		}
	}
}
